package com.wn.quality.web;

import com.wn.common.PageBean;
import com.wn.common.ResponseEntity;
import com.wn.entity.ProductInspection;
import com.wn.quality.service.ProductInspectionService;
import com.wn.quality.vo.ProductInspectionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wuqingting
 * @date 2022/10/24
 */
@RestController
@RequestMapping("/quality/product")
public class ProductInspectionController {
    @Autowired
    private ProductInspectionService productInspectionService;

    @RequestMapping("/add")
    public ResponseEntity add(ProductInspection productInspection){
        productInspectionService.add(productInspection);

        return ResponseEntity.success;
    }

    @RequestMapping("/update")
    public ResponseEntity update(ProductInspection productInspection){
        productInspectionService.complete(productInspection);

        return ResponseEntity.success;
    }

    @RequestMapping("/getPage")
    public ResponseEntity getPage(ProductInspectionVo productInspectionVo){
        PageBean<ProductInspection> pageBean = productInspectionService.getPageByCondition
                (productInspectionVo.getProductInspection(), productInspectionVo.getCurrPage(), productInspectionVo.getPageSize());

        return new ResponseEntity(pageBean);
    }
}
